package org.mspring.mlog.web.admin;

import com.google.common.collect.Maps;
import org.mspring.mlog.web.BaseAdminController;
import org.mspring.mlog.service.CommentEntityService;
import org.mspring.nbee.web.support.WebContext;
import org.mspring.nbee.web.view.json.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author GaoYoubo
 * @since 2015/2/20
 */
@Controller
@RequestMapping("/admin/test")
public class TestController extends BaseAdminController {
    private CommentEntityService commentEntityService;

    @RequestMapping("/sync-duoshuo")
    @ResponseBody
    public JsonResult syncDuoshuo(WebContext context) {
        commentEntityService.syncFromDuoshuo();
        return JsonResult.getJsonResult(true);
    }

    @ResponseBody
    @RequestMapping("/1")
    public JsonResult fuck() {
        Map<String, Object> map = Maps.newHashMap();
        map.put("1", "a");
        map.put("2", "b");
        return JsonResult.getJsonResult(map);
    }

    @Autowired
    public void setCommentEntityService(CommentEntityService commentEntityService) {
        this.commentEntityService = commentEntityService;
    }
}
